﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeArt.SharePoint.Configuration
{ 
    using System.Configuration;
   
	public class PickerControlCollection : ConfigurationElementCollection
    {

        public PickerControlElement this[object key]
        {
            get
            {
                return base.BaseGet(key) as PickerControlElement;
            }
        }

        public PickerControlElement this[int index]
        {
            get
            {
                return base.BaseGet(index) as PickerControlElement;
            }
            set
            {
                if (base.BaseGet(index) != null)
                {
                    base.BaseRemoveAt(index);
                }
                //
                this.BaseAdd(index, value);
            }
        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.AddRemoveClearMap;
            }
        }

        public PickerControlCollection() { }

        protected override ConfigurationElement CreateNewElement()
        {
            return new PickerControlElement();
        }

        protected override string ElementName
        {
            get
            {
                return "pickerControl";
            }
        }
        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((PickerControlElement)element).Name;
        }

    }

}
